package com.qf.boot2202day03.vo;

import com.qf.boot2202day03.utils.Constants;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultVo {

    private Integer code;

    private String message;

    // 用于给前端返回数据
    private Object data;


    public ResultVo(Integer code, String message) {
        this.code = code;
        this.message = message;
    }


    public static ResultVo fail(String msg){

        final ResultVo resultVo = new ResultVo();

        resultVo.setCode(Constants.FAIL_CODE);

        resultVo.setMessage(msg);

        return resultVo;

    }
}
